package com.eningqu.aipen.ui.view;

import android.app.PendingIntent;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

import com.eningqu.aipen.demo.R;
import com.eningqu.aipen.ui.MainActivity;

/**
 * Package:com.eningqu.aipen.ui.view
 * Author:starr
 * Time:11/25/2023 4:52 PM
 * Description: 桌面小部件
 */
public class MedicalAppWidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.onUpdate(context, appWidgetManager, appWidgetIds);

        Intent intent=new Intent(context, MainActivity.class);
        PendingIntent pendingIntent=PendingIntent.getActivity(context,0,intent,0);

        RemoteViews views=new RemoteViews(context.getPackageName(), R.layout.widget_provider);
        views.setOnClickPendingIntent(R.id.ll_remote,pendingIntent);
        appWidgetManager.updateAppWidget(appWidgetIds,views);
    }
}
